package com.winz.cultureapp.adapter.xrcv;

import android.content.Context;
import android.view.View;

import com.mine.xrecyclerview.rcvadapter.BaseRcvAdapter;
import com.mine.xrecyclerview.rcvadapter.ViewHolder;
import com.winz.cultureapp.R;
import com.winz.cultureapp.entity.MessageListBean;

import java.util.List;

/**
 * 我的消息
 */

public class MessageDataAdapter extends BaseRcvAdapter<MessageListBean.DataBean.ListBean> {

    public MessageDataAdapter(Context context, List<MessageListBean.DataBean.ListBean> datas, int... resid) {
        super(context, datas, resid);
    }

    @Override
    public void convert(ViewHolder holder, MessageListBean.DataBean.ListBean data, int itemViewType) {

    }

    @Override
    public void convert(int position, ViewHolder holder, MessageListBean.DataBean.ListBean listBean, int itemViewType) {
        super.convert(position, holder, listBean, itemViewType);
        if (itemViewType != -1){

            holder.setText(R.id.tv_title,listBean.title)
                    .setText(R.id.tv_time,listBean.createTime);


            // 处理头尾
            if(position == 0){
                holder.getView(R.id.view_header).setVisibility(View.VISIBLE);
                holder.getView(R.id.ll_root).setBackgroundResource(R.drawable.shape_header_up);
            }else{
                holder.getView(R.id.view_header).setVisibility(View.GONE);
                holder.getView(R.id.ll_root).setBackgroundResource(R.drawable.shape_header_mid);
            }
            if (position == mDatas.size()-1){
                holder.getView(R.id.view_bottom).setVisibility(View.GONE);
            }else {
                holder.getView(R.id.view_bottom).setVisibility(View.VISIBLE);
            }
        }


    }
}
